﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;

namespace ISolutions.SharePoint.Mui.Impl
{
    public static class MuiHelper
    {
        /// <summary>
        /// Gets all languages
        /// </summary>
        /// <returns></returns>
        public static Dictionary<string, string> GetLanguages()
        {
            Dictionary<string, string> languages = new Dictionary<string, string>();

            foreach (System.Globalization.CultureInfo c in SPContext.Current.Web.SupportedUICultures)
            {
                languages.Add(c.LCID.ToString(), c.TwoLetterISOLanguageName);
            }

            return languages;
        }

        public static List<string> GetLanguagesCodes()
        {
            List<string> codes = new List<string>();
            foreach (System.Globalization.CultureInfo c in SPContext.Current.Web.SupportedUICultures)
            {
                codes.Add(c.LCID.ToString());
            }
            return codes;
        }

        public static string GetDefaultLanguage()
        {
            return SPContext.Current.Web.Language.ToString();
        }
    }
}
